﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using MappingGenerator;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;

namespace UnitTesing
{
    /// <summary>
    /// Summary description for FileOutPutTest
    /// </summary>
    [TestClass]
    public class FileOutPutTest
    {
        public FileOutPutTest()
        {
            //
            // TODO: Add constructor logic here
            //
        }

       

        [TestMethod]
        public void Initialize()
        {
            var o = new FileOutPut();
            Assert.IsNotNull(o);
        }
        [TestMethod]
        public void SaveFile()
        {
            var o = new FileOutPut();
           o.SavePath = "c:\\";
            string text = "siri palai sumanai mada midule";
            o.WriteFile("badubanis.cs",text);
            string expectedPath = "c:\\badubanis.cs";
            Assert.IsTrue(File.Exists(expectedPath));
            Assert.IsTrue(string.Equals(File.ReadAllText(expectedPath),text));


        }
        [TestMethod]
        public void CreatesRootFolder()
        {
            var o = new FileOutPut();
            o.SavePath = "c:\\temp";
            string text = "siri palai sumanai mada midule";
            o.WriteFile("badubanis.cs", text);
            string expectedPath = "c:\\badubanis.cs";
            Assert.IsTrue(File.Exists(expectedPath));
            Assert.IsTrue(string.Equals(File.ReadAllText(expectedPath), text));


        }
    }
}
